function table.removeObj(tbl, obj)
    for i = #tbl, 1, -1 do
        if tbl[i] == obj then
            table.remove(tbl, i)
            break
        end
    end
end
local depthPre = {}

local function _dump(tbl, depth, depthMax)
    for k, v in pairs(tbl) do
        if type(v) == "table" and depth <= depthMax then
            print(depthPre[depth]..k)
            _dump(v, depth + 1, depthMax)
        else
            print(depthPre[depth]..k, v)
        end
    end
end
function table.dump(tbl, depth, depthMax)
    local pre = ''
    depth = depth or 0
    depthMax = depthMax or 5
    depthPre[0] = ""
    for i = 1, depthMax do
        pre = pre.."--"
        depthPre[i] = pre
    end
    _dump(tbl, depth, depthMax)
end

function table.deepClone(t)
    local ret = {}
    for k, v in pairs(t) do
        if type(v) == "table" then
            ret[k] = table.deepClone(v)
        else
            ret[k] = v
        end
    end
    return ret
end

function table.join(tbl1, tbl2)
    for i, v in ipairs(tbl2) do
        table.insert(tbl1, v)
    end
end

function table.hasElement(tbl, e)
    for i, v in ipairs(tbl) do
        if v == e then
            return true
        end
    end
    return false
end